#include "kx/X11Helper.h"

bool IsValue(const Kx::X11Window &window)
{
    return window.mWindowTitle == "New Tab - Chromium";
};

int main()
{

    Kx::X11Helper x11Helper;

    if (!x11Helper.OpenDisplay())
    {
        std::cerr << "Unable to open display." << std::endl;
        return 1;
    }

    std::vector<Kx::X11Window> windows = x11Helper.GetAllWindows(IsValue);

    for (auto &window : windows)
    {
        KX_LOGD("title %s", window.mWindowTitle.c_str());
    }

    if (windows.size() > 0)
    {
        windows[0].SaveCurrentImage("chromium.png");
    }

    x11Helper.CloseDisplay();

    return 0;
}
